#include<bits/stdc++.h>
using namespace std;

int a[10000];

int main()
{
	int n, k;
	while(cin>>n>>k)
	{
		int cnt = 1;
		a[cnt++] = n;
		int mx = ceil(log(k+1)/log(2))+1;
		for(int i = 1;i <= k;i++)
		{
			a[cnt++] = a[i]*2+1;
			a[cnt++] = a[i]*3+1;
		}
		sort(a+1, a+k+1);
		cout<<a[k]<<endl;
	}
    return 0;
}

